The general outline for the rule base is as follows:
global declarations
fact declarations
assignments
rules & daemons
We will address each of these topics in the following sections. The complete BNF for the rule base is as follows:
rule_base := [global_declarations]
[fact_declarations]
[assignments]
[ { rule | daemon } ]
global_declarations := GLOBAL global_id { , global_id}
fact_declarations := FACT fact_id { , fact_id}
rule := [RULE rule_id]
IF conditionals
THEN {assignments | conclusion}
[ELSE {assignments | conclusion}]
[END IF [END rule_id]]
daemon := [daemon_id]
WHEN conditionals
THEN assignments
[ELSE assignments]
[END IF [END daemon_id]]
conditionals := rel_exp { log_op rel_exp }
rel_exp := [NOT] operand rel_op [NOT] operand |
[NOT] operand |
[NOT] ( conditionals )
rel_op := > | >= | = | <> | <= | <
log_op := AND | OR
assignments := { PUT operand INTO target }
conclusion := GO [TO [CARD]] card_id
operand := [#]FACT fact_id |
global_id |
real_number |
integer |
boolean |
quoted_string |
simple_string |
"?" | ? | "*" | * | ""
target := FACT fact_id |
global_id
global_id := simple_string
rule_id := string
daemon_id := string
fact_id := string
card_id := string
string := simple_string | quoted_string
Comments in the rule base are delineated by preceding the comment with "--" just as in HyperTalk. Everything from the comment indicator to the end of line marker (carriage return) will be considered a comment. Automatic line wraps are ignored.
You should enter your rule base in the card field labeled "Rule Base" on the
compiler card. The rule base is limited to only by the size and number of fields used and the amount of memory available to you. HyperCard fields are limited to 32000 characters and Xrules limits you to 16 fields for the rule base.